<?php

defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select');
$user	= JFactory::getUser();				
$isAdmin = $user->get("isRoot");
?>
<script type="text/javascript">
	Joomla.submitbutton = function(task)
	{
		if (task == 'item.cancel' || document.formvalidator.isValid(document.id('item-form')))
		{
			<?php echo $this->form->getField('description')->save(); ?>
			Joomla.submitform(task, document.getElementById('item-form'));
		}
	}

</script>

<form action="<?php echo JRoute::_('index.php?option=com_bakerys&view=items&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" class="form-validate">
	<div class="row-fluid">

		<div class="span12 form-horizontal">

				<div class="control-group">
					<div class="control-label"><?php echo $this->form->getLabel('title'); ?></div>
					<div class="controls"><?php echo $this->form->getInput('title'); ?></div>
				</div>
				
				<div class="control-group">
					<div class="control-label"><?php echo $this->form->getLabel('alias'); ?></div>
					<div class="controls"><?php echo $this->form->getInput('alias'); ?></div>
				</div>
				
				<div class="control-group">
					<div class="control-label"><?php echo $this->form->getLabel('catid'); ?></div>
					<div class="controls"><?php echo $this->form->getInput('catid'); ?></div>
				</div>
				
				<div class="control-group">
					<div class="control-label"><?php echo $this->form->getLabel('price'); ?></div>
					<div class="controls"><?php echo $this->form->getInput('price'); ?></div>
				</div>
				<?php if(!$isAdmin):?>
				<div class="control-group">
					<div class="control-label">
						<label id="jform_price-lbl" for="jform_price" class=" required" aria-invalid="false">
							<?php echo JText::_("COM_BAKERYS_ITEMS_LOCATION_PRICE") ?><span class="star">&nbsp;*</span>
						</label>
					</div>
					<div class="controls">
						<input type="text" name="jform[location_price]" id="jform_price" value="<?php echo $this->item->location_price ?>" class="inputbox required" size="40" aria-required="true" required="required" aria-invalid="false">
					</div>
				</div>
				<?php endif?>
				<div class="control-group">
					<div class="control-label"><?php echo $this->form->getLabel('images'); ?></div>
					<div class="controls"><?php echo $this->form->getInput('images'); ?></div>
				</div>
				
				<div class="control-group">
					<div class="control-label">
						<?php echo $this->form->getLabel('state'); ?>
					</div>
					<div class="controls">
						<?php echo $this->form->getInput('state'); ?>
					</div>
				</div>
				
				<div class="control-group">
					<div class="control-label"><?php echo $this->form->getLabel('ordering'); ?></div>
					<div class="controls"><?php echo $this->form->getInput('ordering'); ?></div>
				</div>
				
				<div class="control-group">
					<div class="control-label"><?php echo $this->form->getLabel('introtext'); ?></div>
					<div class="controls"><?php echo $this->form->getInput('introtext'); ?></div>
				</div>
				
				<div class="control-group">
					<div class="control-label"><?php echo $this->form->getLabel('description'); ?></div>
					<div class="controls"><?php echo $this->form->getInput('description'); ?></div>
				</div>

			<input type="hidden" name="task" value="" />
			<?php echo JHtml::_('form.token'); ?>
		</div>
	</div>
		
</form>

